/**
 * Created by henian.xu on 2017/7/19.
 *
 */

import * as types from './types';
import LocalStorage from '@/utils/localStorage';
import Api from '@/api';

export default {
    [types.USER_INFO](state, data) {
        state[types.USER_INFO] = {
            ...state[types.USER_INFO],
            ...data,
        };
        Api.auth(data.token);
        LocalStorage.set(types.USER_INFO, state[types.USER_INFO]);
    },
};
